#include <iostream>
#include <set>
#include <vector>
#include <list>

using namespace std;


//使用迭代器遍历
void Test01() {
	set<int> s;
	s.insert(1);
	s.insert(1);
	s.insert(2);
	s.insert(3);
	for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
		cout << *it << "\n";
	}
}

//迭代器是在STL容器中是通用的，下面用迭代器遍历vector
void Test02() {
	vector<int> v = { 1, 1, 2, 3};
	for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) {
		cout << *it << "\n";
	}
}

//用迭代器遍历list
void Test03(){
    list<int> l = { 1, 1, 2, 3};
    for (list<int>::iterator it = l.begin(); it != l.end(); ++it) {
        cout << *it << "\n";
    }
}


/**
 * 使用迭代器遍历stl容器
 */
int main() {
	//Test01();

	//Test02();

    Test03();

		
    return 0;
}